#include <iostream>
#define N 100

using namespace std;

// problem at pos_i, pos_j;

void read_matrix(int matrix[N][N], int row, int column){
int i, j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++){
        cout<<"m["<<i<<"]["<<j<<"]= ";
        cin>>matrix[i][j];}
}

int sum_of_matrix(int matrix[N][N], int row, int column){
int sum=0;
int max=matrix[0][0];
int i,j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++){
        sum+= matrix[i][j];
        if(max<matrix[i][j])
            max=matrix[i][j];}
return sum;
}

int max_of_matrix(int matrix[N][N],int row, int column, int pos_i, int pos_j){
int max=matrix[0][0];
int i, j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++)
        if(max<matrix[i][j]){
            max=matrix[i][j];
            pos_i=i;
            pos_j=j;}
return max;
}



int main(){
int row;
int column;
int matrix[N][N];
int sum_value;
int max_value;
int pos_i;
int pos_j;

cout<<"Type the number of rows: " ;
cin>>row;

cout<<"Type the number of columns: " ;
cin>>column;

read_matrix(matrix, row, column);

sum_value=sum_of_matrix(matrix, row, column);
max_value=max_of_matrix(matrix, row, column, pos_i, pos_j);
cout<<"The sum of the matrix elements is: "<<sum_value<<endl;
cout<<"The maximum value is: " << max_value <<" on position " <<pos_i<<" " <<pos_j<<"\n";

return 0;
}
